<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>WebSocket</title>
  <script src="socket.io.js"></script>
</head>

<body>
  <script>
    var socket = io('ws://localhost:3000');
    socket.on('news', function (data) {
      console.log(data);
      socket.emit('my other event', { my: 'data' });
    });
  </script>
</body>

</html>